pp108 : showError() Method

showError() Method


This method displays error messages. The error message may include additional information such as Help details.

Syntax

application.showError(sMessage,[sTitle],[oControl],[oFeedbackObject]);

Parameters

Parameter

Description

sMessage

Required. String that denotes the error message to be displayed.

sTitle

Optional. String that denotes the title of the error message.

oControl

Optional. An HTML object that refers to the control for which the error message is issued. When specified for a control, the error message is positioned near the control, instead of being stacked with other error messages.

oFeedbackObject

Optional. A JavaScript object that helps convert the error description into a hyperlink. Clicking the description opens the detailed message in a separate window. This object comprises the following properties:

  • applicationDefinition : If specified,application.select()is executed with the application definition, when you click the error message.
  • callbackFunction : Denotes a function pointer. When specified, it is executed when you click the error message.
  • relatedHTMLelement : It denotes an HTML object. When specified, it will set the focus to the HTML object on click of the error message.
  • detail : It refers to an XML element node. When specified, it displays the details of the error message in a separate window that can be expanded or collapsed using the More or Less option.


Return Value


It does not return a value.

Remarks


You must provide the textual content to be displayed as the error. Error messages display buttons to close them.

Example


The following example demonstrates how to display stacked error messages.

function showStackedError()
{
    var feedbackObject = new Object();
    // inputName is the Id of html Element.
   	feedbackObject.relatedHTMLElement = document.getElementById("inputName");
	feedbackObject.callbackFunction = callbackHandler;
    	feedbackObject.applicationDefinition = newApplication.XMLDocument.documentElement;
    	application.showError("Click Here to execute the callback function.", "Test", null, feedbackObject);
}
function callbackHandler()
{
	   // the code to be executed onclick of the error message link.
}
<xml id="newApplication">
    <Application>
          <url>Application URL </url>
          <id>Application Id</id>
          <caption>Application caption</caption>
	         <description>Application description</description>
	         <frame>main</frame>
          <data/>
	   </Application>
</xml>
<html>
<body>
       <div>
             <label>Name :</label><input id="inputName" class="input" type="text"/>
       </div>
</body>
</html>


The following example demonstrates how to display an error message for an HTML element.

function showErrorNearInput()
{
    var feedbackObject = new Object();
    // inputName is the Id of html Element.
   	feedbackObject.relatedHTMLElement = document.getElementById("inputName");
	   feedbackObject.callbackFunction = callbackHandler;
    feedbackObject.applicationDefinition = newApplication.XMLDocument.documentElement;
    application.showError("Click Here to execute the callback function.", "Test", document.getElementById("inputName"), feedbackObject);
}
function callbackHandler()
{
	   // the code to be executed onclick of the error message link.
}
<script type="cordys/xml" id="newApplication">
    <Application>
          <url>Application URL </url>
          <id>Application Id</id>
          <caption>Application caption</caption>
	         <description>Application description</description>
	         <frame>main</frame>
          <data/>
	   </Application>
</xml>
<html>
<body>
       <div>
             <label>Name :</label><input id="inputName" class="input" type="text"/>
       </div>
</body>
</html>